<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="Services.aspx.cs" Inherits="Services" Title="Services Manager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <span style="font-size: 32pt"><strong>Service Manager</strong></span><br />
    <br />
    <asp:Label ID="Label2" runat="server" ForeColor="Red"></asp:Label><br />
    <table style="width: 371px">
        <tr>
            <td style="width: 20px">
                Name:</td>
            <td style="width: 100px">
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
        </tr>
        <tr>
            <td style="width: 20px">
            </td>
            <td style="width: 100px">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                    ErrorMessage="Name cannot be blank" Width="159px"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td style="width: 20px">
                Fee:</td>
            <td style="width: 100px">
                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>&nbsp;
            </td>
        </tr>
        <tr>
            <td style="width: 20px">
                <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label></td>
            <td style="width: 100px">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
                    ErrorMessage="Fee cannot be blank" Width="124px"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td style="width: 20px">
                Image:</td>
            <td style="width: 100px">
                <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td style="width: 20px">
            </td>
            <td style="width: 100px">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Add new service" /></td>
        </tr>
    </table>
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"
        ForeColor="Black" GridLines="Vertical" DataKeyNames="ServiceId" DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px">
        <Columns>
            <asp:BoundField DataField="ServiceId" HeaderText="ServiceId" InsertVisible="False"
                ReadOnly="True" SortExpression="ServiceId" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="Fee" HeaderText="Fee" SortExpression="Fee" />
            <asp:BoundField DataField="IMG" HeaderText="IMG" SortExpression="IMG" />
            <asp:CommandField ShowEditButton="True" />
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#CCCCCC" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Con %>"
        DeleteCommand="DELETE FROM [Service] WHERE [ServiceId] = @ServiceId" InsertCommand="INSERT INTO [Service] ([Name], [Fee], [IMG]) VALUES (@Name, @Fee, @IMG)"
        SelectCommand="SELECT * FROM [Service]" UpdateCommand="UPDATE [Service] SET [Name] = @Name, [Fee] = @Fee, [IMG] = @IMG WHERE [ServiceId] = @ServiceId">
        <DeleteParameters>
            <asp:Parameter Name="ServiceId" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Fee" Type="Decimal" />
            <asp:Parameter Name="IMG" Type="String" />
            <asp:Parameter Name="ServiceId" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Fee" Type="Decimal" />
            <asp:Parameter Name="IMG" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

